<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link th:href="@{favicon.ico}"  rel="shortcut icon"/>
    <title>上传页</title>
    <script th:src="@{/webjars/jquery/dist/jquery.js}"  type="text/javascript"></script>

</head>
<body>
    <div class="con">
        <form action="multiUpload" method="post" enctype="multipart/form-data">
            <input type="file" name="file"><br/>
            <input type="file" name="file"><br/>
            如上传图片：会展示最后一个上传的图片： <input type="file" name="file"><br/>
            <button type="submit">上传</button>
        </form>

        <img th:src="${filePath}" width="300px" height="300px">
        <div th:if="${ message }">
            <h2 th:text="${ message }"/>
        </div>
    </div>
    <div>
        下载文件名：
        <input type="text" value="" id="fileName"/>
        <input type="button" value="下载"  onclick="download()"/>
        <script>
            $(document).ready(function(){
            });
            function download(){
                let fileName = $("#fileName").val();
                if(fileName){
                    window.open("http://" + window.location.host + "/download/" + fileName, '_blank')
                }else{
                    alert("输入文件名")
                }
            }
        </script>
    </div>
</body>
</html>